<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
	<meta HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
	<meta HTTP-EQUIV="Expires" CONTENT="0">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>电子公示板管理</title>
<style type="text/css">
	@import "../dojo-release-1.5.0/dijit/themes/tundra/tundra.css";
	@import "../dojo-release-1.5.0/dojo/resources/dojo.css";
	@import "../dojo-release-1.5.0/dojox/grid/resources/tundraGrid.css";
</style>
<script type="text/javascript" src="../dojo-release-1.5.0/dojo/dojo.js" djConfig="parseOnLoad:true"></script>
<script type="text/javascript" src="../framework/uiutil.js"></script>
<script type="text/javascript" src="../framework/simpleCRUDUtil.js"></script>
<script type="text/javascript">
var SCU = new SimpleCrudUtil({
	c:"../bkgrd/newDashboard.do",
	r:"../bkgrd/getAllDashboard.do",
	d:"../bkgrd/deleteDashboard.do",
	grid:"grid",
	idName:"dashboardName"
});
dojo.addOnLoad(function(){
	SCU.R();
	initTemplateFileSelect();
});

function initTemplateFileSelect(){
	dojo.xhrGet({
		 url:"../bkgrd/getAllDashboardViewTemplateFileName.do",
		 handleAs:"json",
		 preventCache:true,
		 load:function(response){
			 var ps = [];
			 for(var i in response){
				 ps.push({value:response[i],name:response[i]});
			 }
			 D.initCombo("templateFileName",ps)
		 }
	});
}

function saveDashboard(){
	var dashboardName = dojo.byId("dashboardName").value;
	var description = dojo.byId("description").value;
	var scheme = dojo.byId("scheme").value;
	var templateFileName = D.getComboValue("templateFileName");
	
	if(dashboardName == '' || templateFileName == '' || scheme =='' ){
		alert("除描述外，其他必须输入");
		return;
	}
	SCU.C({dashboardName:dashboardName,description:description,scheme:scheme,templateFileName:templateFileName});
}

function deleteDashboard(){
	SCU.D();
}
</script>

<style type="text/css">
#grid{
	border:1px solid #333;
	width:95%;
	margin:10px;
	height:500px;
	font-size:0.9em;
}
</style>
</head>
<body class="tundra">

新增电子公示板
<table width="100%">
<tr><td>公示板代号</td><td><input type="text" dojoType="dijit.form.TextBox" id="dashboardName" size="30" trim="true" value="" required="true"/></td></tr>
<tr><td>描述</td><td><input type="text" dojoType="dijit.form.TextBox" id="description" size="30" trim="true" value=""/></td></tr>
<tr><td>视图模板</td><td><select dojoType="dijit.form.ComboBox" id="templateFileName" value="" required="true" ></select></td></tr>
<tr><td>模式</td><td><input type="text" dojoType="dijit.form.TextBox" id="scheme" size="30" trim="true" value="" required="true"/></td></tr>
<tr><td colspan="2">
<button dojoType="dijit.form.Button" id="query" onclick="saveDashboard()">保存公示板</button>
<button dojoType="dijit.form.Button" id="delete" onclick="deleteDashboard()">删除公示板</button>
</td></tr>
</table>

<table dojoType="dojox.grid.DataGrid" id="grid"  autoWidth="true">
<thead>
	<tr>
	     <th field="dashboardName" width="100px">公示板代号</th>
	     <th field="description" width="300px">描述</th>
	     <th field="templateFileName" width="300px">视图模板</th>
	     <th field="scheme" width="300px">模式</th>
	</tr>
</thead>
</table>
</body>
</html>